set mem 550m
set matsize 5000
log using "G:\whalley\projects\college_spending\programs\analysis\RESTAT_final\tableA1_M2.log", replace
#delimit ;
set more 1;
*
* TABLEA1_M2.DO
* BY Alex Whalley
* VERSION OF 08/01/08
*;
use "G:\whalley\projects\college_spending\programs\analysis\RESTAT_final\main_data.dta";
*
* KEEP ONLY ABOVE MEDIAN GRAD FRACT COUNTIES
*;
keep if mfrac_grad81 == 1;
*
* DROP SMALL COUNTIES
*;
drop if totpop < 250000;
*
* REORMALIZE TOTAL EXPENDITURE
*;
gen ECFET5d1p = ECFET5d1 / 1000; 
drop ECFET5d1;
rename ECFET5d1p ECFET5d1;
gen ECFET3d3p = ECFET3d3 / 1000; 
drop ECFET3d3;
rename ECFET3d3p ECFET3d3;
gen endowl6_spindexd5d1_1 = endowl6_spindexd5d1 / 1000;
drop endowl6_spindexd5d1;
rename endowl6_spindexd5d1_1 endowl6_spindexd5d1;
collapse (mean) ECFET5d1 endowl6_spindexd5d1 lincome5d1 lemp5d1 (sum) semp81, by(year FIPSCOUNTY); 
*
* PART (1): DO REGRESSIONS WITH SIC FES AND CORRELATIONS
*
* PART (A): LOOK AT IV FIRST STAGE
*;
xi: reg ECFET5d1 endowl6_spindexd5d1 i.year [fw=semp81], cluster(FIPSCOUNTY);
test endowl6_spindexd5d1;
sum ECFET5d1 if endowl6_spindexd5d1 !=.;
*
* PART (B1): INCOME
*;
xi: ivreg lincome5d1 (ECFET5d1=endowl6_spindexd5d1 ) i.year [fw=semp81] , cluster(FIPSCOUNTY); 
sum lincome5d1 if endowl6_spindexd5d1 != .;
*
* READ IN DATA
* 
* NOTE: ALL VALUES ARE NOMINAL
*;
clear;
* 
* NOTE: ALL VALUES ARE NOMINAL
*;
use "G:\whalley\projects\college_spending\programs\analysis\RESTAT_final\main_data.dta", replace;
*
* KEEP ONLY BELOW MEDIAN GRAD FRAC COUNTIES
*;
keep if mfrac_grad81 == 0;
*
* DROP SMALL COUNTIES
*;
drop if totpop < 250000;
*
* REORMALIZE TOTAL EXPENDITURE
*;
gen ECFET5d1p = ECFET5d1 / 1000; 
drop ECFET5d1;
rename ECFET5d1p ECFET5d1;
gen ECFET3d3p = ECFET3d3 / 1000; 
drop ECFET3d3;
rename ECFET3d3p ECFET3d3;
gen endowl6_spindexd5d1_1 = endowl6_spindexd5d1 / 1000;
drop endowl6_spindexd5d1;
rename endowl6_spindexd5d1_1 endowl6_spindexd5d1;
collapse (mean) ECFET5d1 endowl6_spindexd5d1 lincome5d1 lemp5d1 (sum) semp81, by(year FIPSCOUNTY); 
*
* PART (1): DO REGRESSIONS WITH SIC FES AND CORRELATIONS
*
* PART (A): LOOK AT IV FIRST STAGE
*;
xi: reg ECFET5d1 endowl6_spindexd5d1 i.year [fw=semp81], cluster(FIPSCOUNTY);
test endowl6_spindexd5d1;
*
* PART (B1): INCOME
*;
xi: ivreg lincome5d1 (ECFET5d1=endowl6_spindexd5d1 ) i.year [fw=semp81] , cluster(FIPSCOUNTY); 
sum lincome5d1 if endowl6_spindexd5d1 != .;

sum ECFET5d1 if endowl6_spindexd5d1 !=.;
*
* READ IN DATA
* 
* NOTE: ALL VALUES ARE NOMINAL
*;
clear;
* 
* NOTE: ALL VALUES ARE NOMINAL
*;
use "G:\whalley\projects\college_spending\programs\analysis\RESTAT_final\main_data.dta", replace;
*
* KEEP ONLY ABOVE MEDIAN POOLING INDUSTRIES COUNTIES
*;
keep if high_trans_prob == 1;
*
* DROP SMALL COUNTIES
*;
drop if totpop < 250000;
*
* REORMALIZE TOTAL EXPENDITURE
*;
gen ECFET5d1p = ECFET5d1 / 1000; 
drop ECFET5d1;
rename ECFET5d1p ECFET5d1;
gen ECFET3d3p = ECFET3d3 / 1000; 
drop ECFET3d3;
rename ECFET3d3p ECFET3d3;
gen endowl6_spindexd5d1_1 = endowl6_spindexd5d1 / 1000;
drop endowl6_spindexd5d1;
rename endowl6_spindexd5d1_1 endowl6_spindexd5d1;
collapse (mean) ECFET5d1 endowl6_spindexd5d1 lincome5d1 lemp5d1 (sum) semp81, by(year FIPSCOUNTY); 
*
* PART (1): DO REGRESSIONS WITH SIC FES AND CORRELATIONS
*
* PART (A): LOOK AT IV FIRST STAGE
*;
xi: reg ECFET5d1 endowl6_spindexd5d1 i.year [fw=semp81], cluster(FIPSCOUNTY);
test endowl6_spindexd5d1;
*
* PART (B1): INCOME
*;
xi: ivreg lincome5d1 (ECFET5d1=endowl6_spindexd5d1 ) i.year [fw=semp81] , cluster(FIPSCOUNTY); 
sum lincome5d1 if endowl6_spindexd5d1 != .;
sum ECFET5d1 if endowl6_spindexd5d1 !=.;
*
* READ IN DATA
* 
* NOTE: ALL VALUES ARE NOMINAL
*;
clear;
* 
* NOTE: ALL VALUES ARE NOMINAL
*;
use "G:\whalley\projects\college_spending\programs\analysis\RESTAT_final\main_data.dta", replace;
*
* KEEP ONLY BELOW MEDIAN POOLING INDUSTRIES 
*;
keep if high_trans_prob == 0;
*
* DROP SMALL COUNTIES
*;
drop if totpop < 250000;
*
* REORMALIZE TOTAL EXPENDITURE
*;
gen ECFET5d1p = ECFET5d1 / 1000; 
drop ECFET5d1;
rename ECFET5d1p ECFET5d1;
gen ECFET3d3p = ECFET3d3 / 1000; 
drop ECFET3d3;
rename ECFET3d3p ECFET3d3;
gen endowl6_spindexd5d1_1 = endowl6_spindexd5d1 / 1000;
drop endowl6_spindexd5d1;
rename endowl6_spindexd5d1_1 endowl6_spindexd5d1;
collapse (mean) ECFET5d1 endowl6_spindexd5d1 lincome5d1 lemp5d1 (sum) semp81, by(year FIPSCOUNTY); 
*
* PART (1): DO REGRESSIONS WITH SIC FES AND CORRELATIONS
*
* PART (A): LOOK AT IV FIRST STAGE
*;
xi: reg ECFET5d1 endowl6_spindexd5d1 i.year [fw=semp81], cluster(FIPSCOUNTY);
test endowl6_spindexd5d1;
*
* PART (B1): INCOME
*;
xi: ivreg lincome5d1 (ECFET5d1=endowl6_spindexd5d1 ) i.year [fw=semp81] , cluster(FIPSCOUNTY); 
sum lincome5d1 if endowl6_spindexd5d1 != .;
sum ECFET5d1 if endowl6_spindexd5d1 !=.;
*
* READ IN DATA
* 
* NOTE: ALL VALUES ARE NOMINAL
*;
clear;
* 
* NOTE: ALL VALUES ARE NOMINAL
*;
use "G:\whalley\projects\college_spending\programs\analysis\RESTAT_final\main_data.dta", replace;
*
* KEEP ONLY ABOVE MEDIAN PATENT INDUSTRIES
*;
keep if high_frac_univ == 1;
*
* DROP SMALL COUNTIES
*;
drop if totpop < 250000;
*
* REORMALIZE TOTAL EXPENDITURE
*;
gen ECFET5d1p = ECFET5d1 / 1000; 
drop ECFET5d1;
rename ECFET5d1p ECFET5d1;
gen ECFET3d3p = ECFET3d3 / 1000; 
drop ECFET3d3;
rename ECFET3d3p ECFET3d3;
gen endowl6_spindexd5d1_1 = endowl6_spindexd5d1 / 1000;
drop endowl6_spindexd5d1;
rename endowl6_spindexd5d1_1 endowl6_spindexd5d1;
collapse (mean) ECFET5d1 endowl6_spindexd5d1 lincome5d1 lemp5d1 (sum) semp81, by(year FIPSCOUNTY); 
*
* PART (1): DO REGRESSIONS WITH SIC FES AND CORRELATIONS
*
* PART (A): LOOK AT IV FIRST STAGE
*;
xi: reg ECFET5d1 endowl6_spindexd5d1 i.year [fw=semp81], cluster(FIPSCOUNTY);
test endowl6_spindexd5d1;
*
* PART (B1): INCOME
*;
xi: ivreg lincome5d1 (ECFET5d1=endowl6_spindexd5d1 ) i.year [fw=semp81] , cluster(FIPSCOUNTY); 
sum lincome5d1 if endowl6_spindexd5d1 != .;
sum ECFET5d1 if endowl6_spindexd5d1 !=.;
*
* READ IN DATA
* 
* NOTE: ALL VALUES ARE NOMINAL
*;
clear;
* 
* NOTE: ALL VALUES ARE NOMINAL
*;
use "G:\whalley\projects\college_spending\programs\analysis\RESTAT_final\main_data.dta", replace;
*
* KEEP ONLY BELOW MEDIAN PATENT INDUSTRIES
*;
keep if high_frac_univ == 0;
*
* DROP SMALL COUNTIES
*;
drop if totpop < 250000;
*
* REORMALIZE TOTAL EXPENDITURE
*;
gen ECFET5d1p = ECFET5d1 / 1000; 
drop ECFET5d1;
rename ECFET5d1p ECFET5d1;
gen ECFET3d3p = ECFET3d3 / 1000; 
drop ECFET3d3;
rename ECFET3d3p ECFET3d3;
gen endowl6_spindexd5d1_1 = endowl6_spindexd5d1 / 1000;
drop endowl6_spindexd5d1;
rename endowl6_spindexd5d1_1 endowl6_spindexd5d1;
collapse (mean) ECFET5d1 endowl6_spindexd5d1 lincome5d1 lemp5d1 (sum) semp81, by(year FIPSCOUNTY); 
*
* PART (1): DO REGRESSIONS WITH SIC FES AND CORRELATIONS
*
* PART (A): LOOK AT IV FIRST STAGE
*;
xi: reg ECFET5d1 endowl6_spindexd5d1 i.year [fw=semp81], cluster(FIPSCOUNTY);
test endowl6_spindexd5d1;
*
* PART (B1): INCOME
*;
xi: ivreg lincome5d1 (ECFET5d1=endowl6_spindexd5d1 ) i.year [fw=semp81] , cluster(FIPSCOUNTY); 
sum lincome5d1 if endowl6_spindexd5d1 != .;
sum ECFET5d1 if endowl6_spindexd5d1 !=.;
*
* READ IN DATA
* 
* NOTE: ALL VALUES ARE NOMINAL
*;
clear;
* 
* NOTE: ALL VALUES ARE NOMINAL
*;
use "G:\whalley\projects\college_spending\programs\analysis\RESTAT_final\main_data.dta", replace;
*
* KEEP ONLY ABOVE MEDIAN GRAD FRACT COUNTIES
*;
keep if  high_colgrad == 1;
*
* DROP SMALL COUNTIES
*;
drop if totpop < 250000;
*
* REORMALIZE TOTAL EXPENDITURE
*;
gen ECFET5d1p = ECFET5d1 / 1000; 
drop ECFET5d1;
rename ECFET5d1p ECFET5d1;
gen ECFET3d3p = ECFET3d3 / 1000; 
drop ECFET3d3;
rename ECFET3d3p ECFET3d3;
gen endowl6_spindexd5d1_1 = endowl6_spindexd5d1 / 1000;
drop endowl6_spindexd5d1;
rename endowl6_spindexd5d1_1 endowl6_spindexd5d1;
collapse (mean) ECFET5d1 endowl6_spindexd5d1 lincome5d1 lemp5d1 (sum) semp81, by(year FIPSCOUNTY); 
*
* PART (1): DO REGRESSIONS WITH SIC FES AND CORRELATIONS
*
* PART (A): LOOK AT IV FIRST STAGE
*;
xi: reg ECFET5d1 endowl6_spindexd5d1 i.year [fw=semp81], cluster(FIPSCOUNTY);
test endowl6_spindexd5d1;
*
* PART (B1): INCOME
*;
xi: ivreg lincome5d1 (ECFET5d1=endowl6_spindexd5d1 ) i.year [fw=semp81] , cluster(FIPSCOUNTY); 
sum lincome5d1 if endowl6_spindexd5d1 != .;
sum ECFET5d1 if endowl6_spindexd5d1 !=.;
*
* READ IN DATA
* 
* NOTE: ALL VALUES ARE NOMINAL
*;
clear;
* 
* NOTE: ALL VALUES ARE NOMINAL
*;
use "G:\whalley\projects\college_spending\programs\analysis\RESTAT_final\main_data.dta", replace;
*
* KEEP ONLY BELOW MEDIAN COLLEGE GRAD INDUSTRIES
*;
keep if  high_colgrad == 0;
*
* DROP SMALL COUNTIES
*;
drop if totpop < 250000;
*
* REORMALIZE TOTAL EXPENDITURE
*;
gen ECFET5d1p = ECFET5d1 / 1000; 
drop ECFET5d1;
rename ECFET5d1p ECFET5d1;
gen ECFET3d3p = ECFET3d3 / 1000; 
drop ECFET3d3;
rename ECFET3d3p ECFET3d3;
gen endowl6_spindexd5d1_1 = endowl6_spindexd5d1 / 1000;
drop endowl6_spindexd5d1;
rename endowl6_spindexd5d1_1 endowl6_spindexd5d1;
collapse (mean) ECFET5d1 endowl6_spindexd5d1 lincome5d1 lemp5d1 (sum) semp81, by(year FIPSCOUNTY); 
*
* PART (1): DO REGRESSIONS WITH SIC FES AND CORRELATIONS
*
* PART (A): LOOK AT IV FIRST STAGE
*;
xi: reg ECFET5d1 endowl6_spindexd5d1 i.year [fw=semp81], cluster(FIPSCOUNTY);
test endowl6_spindexd5d1;
*
* PART (B1): INCOME
*;
xi: ivreg lincome5d1 (ECFET5d1=endowl6_spindexd5d1 ) i.year [fw=semp81] , cluster(FIPSCOUNTY); 
sum lincome5d1 if endowl6_spindexd5d1 != .;
sum ECFET5d1 if endowl6_spindexd5d1 !=.;
*
* CLOSE LOG, CLEAR AND END
*;
log close;
*clear;